var pageApp = null;
$(function(){
  pageApp = {
    init: function () {
      this.$location = $('.location');
      this.$tabs = $('.page-tab');
      this.$iframe = $('.iframe');

      this.bind();
    },
    bind: function () {
      this.$tabs.on('click', 'li', $.proxy(this.changeTab, this));
    },
    //切换菜单
    changeTab: function (e) {
      var $this = $(e.currentTarget);
      var url = $this.data("url");
      
      this.$iframe.find("iframe")[0].src = url;
      
      this.changeLocation($this);
    },
    
    changeLocation: function(tab) {
    	tab.siblings().removeClass("active");
    	tab.addClass("active");
    	
    	var location = tab.data("location");
    	
    	this.$location.find(".current").remove();
        
        var pageApp = this;
        $.each(location.split("##"), function(i, location){
      	  pageApp.$location.append('<p class="current">&gt;' + location + '</p> ');
        });
    }
  };

  pageApp.init();
});